package com.zhuoyue.system.mapper;

import com.zhuoyue.common.annotation.DataSource;
import com.zhuoyue.system.domain.TblDeviceActions;
import org.apache.ibatis.annotations.Param;

import java.util.List;

import static com.zhuoyue.common.enums.DataSourceType.SLAVE;

public interface TblDeviceActionsMapper {
    int deleteByPrimaryKey(String id);

    int insert(TblDeviceActions record);

    int insertSelective(TblDeviceActions record);

    TblDeviceActions selectByPrimaryKey(String id);

    int updateByPrimaryKeySelective(TblDeviceActions record);

    int updateByPrimaryKey(TblDeviceActions record);

    @DataSource(SLAVE)
    List<TblDeviceActions> listActionsByDeviceId(@Param("deviceId") String deviceId);

    /**
     * 查询打开状态的设备的数量
     *
     * @param deviceIds 设备ID列表
     * @return 数量
     */
    @DataSource(SLAVE)
    Integer getOpenCountByDeviceId(List<String> deviceIds);
}